<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="utf-8">
    <link rel="stylesheet" href="style.css">
    <title>简约大方的输入框</title>
    <style>
        .app {
            width: 100%;
            height: 100vh;
            background-color: #ffffff;
            position: relative;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        label {
            position: relative;
        }

        input {
            width: 140px;
            height: 36px;
            line-height: 36px;
            outline-style: none;
            font-size: 16px;
            color: #333;
            border: none;
            padding: 0 8px;
            box-sizing: border-box;
        }

        .line {
            width: 0;
            height: 2px;
            display: block;
            background-color: #4158D0;
            background-image: linear-gradient(90deg, #4158D0 0%, #C850C0 48%, #FFCC70 100%);
            transition: all 0.24s ease-in-out;
        }

        input:focus+.line,
        input:valid+.line {
            width: 100%;
        }
    </style>
</head>

<body>
    <div class="app">
        <label>
            <input type="text" placeholder="在此输入文字" required>
            <span class="line"></span>
        </label>
    </div>
</body>

</html>